<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.commons.Constants,
                 com.scalar.chiptrack.users.Functionality,
                 com.scalar.chiptrack.users.User"%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<chiptrack:checkLogon sourcePage="/assemblyBinSetup.do" />

<%String chipTracContext = "/" + ConfigManager.getChipTracContext(); %>
<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252">
    <LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
</HEAD>

<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/bomPartEntry.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<SCRIPT language="JavaScript">

function submitForm()
{
    document.assemblyFormBin.action = "<%=chipTracContext%>/assemblyBinSetup.do?action=save&screenType=baseProductBins";
    document.assemblyFormBin.submit();
}
function loadAssemblyProducts()
{
    document.assemblyFormBin.action = "<%=chipTracContext%>/assemblyBinSetup.do?action=loadAssemblyProducts";
    document.assemblyFormBin.submit();
}
function loadBinsInformation()
{
    document.assemblyFormBin.action = "<%=chipTracContext%>/assemblyBinSetup.do?action=loadBinsInformation&screenType=baseProductBins";
    //document.assemblyFormBin.action.value = "loadBinsInformation";
    document.assemblyFormBin.submit();
}

</script>

<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0" >
    <!-- Top Header Start-->
    <%@ include file="/jsp/includes/header.jsp" %>
    <!-- Top Header End-->
    <TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">

        <TR>
            <TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
                <!-- Side Navigation start -->
                <%@ include file="/jsp/operations/product_menu.jsp" %>
                <!-- end of the side navigations -->
            </TD>
            <TD bgcolor="#ffffff"><IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
            <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
            <TD valign="top" width="100%">
                <html:form action="/assemblyBinSetup.do?screenType=baseProductBins" name="assemblyFormBin" type="com.scalar.chiptrack.operations.bins.forms.AssemblyBinForm"  scope="session">
                <TABLE width='95%' align=right cellpadding='3' cellspacing='2' border='0' bordercolor='black'>
                        <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
                        <TR><Td colspan='4' class="NArialW" align=center>MRB Bin Setup</td></tr>
                        <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
                        <tr><td colspan='4' align="left" class='NArialL'>&nbsp;<FONT id="errors" color='FF0000'></font></td></tr>
                        <TR><TD colspan='4' id="chiptracErrors"><chiptrack:errors styleClass="NArialL"/></TD></TR>
                        <TR><TD colspan='4'><chiptrack:info styleClass="NArialL"/></TD></TR>
                        <logic:equal name="showMessage" value="TRUE">
                        
                        <TR><TD colspan='4' class='NArialS'><font color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b></font></TD></TR>
                        </logic:equal>
                        <bean:size id="BinInfoListSize" name="assemblyFormBin" property="binInformationList" />
			<logic:equal name="BinInfoListSize" value="0">
			    <logic:equal parameter="action" value="loadBinsInformation">
				<TR>
			    		<TD colspan='4' width="100%" class='NArialL'><font color='red'><bold><li>No Bin Details are associated with this Assembly part number</bold></font></TD>
				</TR>
				<TR><TD>&nbsp;</TD></TR>	
			    </logic:equal>
                        </logic:equal> 
                        <TR>
                            <TD class='NArialL' width="15%">Base Products :<br></TD>
                            <TD class="NArialL" width="25%">
                                <html:select property="baseProductId" styleClass="txfield"  onchange="javascript:loadBinsInformation();">
                                    <html:option value="0">Select Base Product</html:option>
                                    <html:options collection="BaseProducts" property="value" labelProperty="label" />
                                </html:select>
                            </TD>
                            <TD class='NArialL' width="20%"><%--Assembly Products :--%>&nbsp;<br></TD>
                            <TD class="NArialL" width="45%">
                                <%--<html:select property="assemblyProccessStepId" styleClass="txfield" onchange="javascript:loadBinsInformation();">
                                    <html:option value="0">Select Assembly Product</html:option>
                                    <html:options collection="AssemblyProducts" property="value" labelProperty="label" />
                                </html:select>--%>
                            </TD>
                        </TR>
                        <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='20'></TD></TR>
                        
                        <logic:greaterThan name="BinInfoListSize" value="0">
                        <TR>
                            <TD colspan='4' width="100%">
                                <TABLE width='100%' align=right cellpadding='3' cellspacing='2' border='0'>
                                    <TR>
                                        <%--<TD align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Select</font></font></TD>--%>
                                        <TD align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Bin Number</font></font></TD>
                                        <TD align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Downsize Bins</font></font></TD>
                                        <TD align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF">Bin Type</font></font></TD>
                                    </TR>
                                    <nested:iterate name="assemblyFormBin" property="binInformationList" id="binInformation" type="com.scalar.chiptrack.operations.process.BinSetup" >
                                    <TR>
                                        <%--<TD align="center" class="NArialL" bgcolor="#DEE1E2"><nested:checkbox property="selectedBin" /></TD>--%>
                                        <TD align="center" class="NArialL" bgcolor="#DEE1E2"><nested:write property="binNo" /><nested:hidden property="binNo" /></TD>
                                        <TD align="center" class="NArialL" bgcolor="#DEE1E2">
                                            <nested:select property="downsizedBinNo" styleClass="txfield">
                                                <html:option value="0">Select Downsize Bin</html:option>
                                                <nested:options property="downsizedBinList" />
                                            </nested:select>
                                        </TD>
                                        <TD align="center" class="NArialL" bgcolor="#DEE1E2"><nested:write property="binType" /><nested:hidden property="binType" /></TD>
                                    </TR>
                                    </nested:iterate>
                                </TABLE>
                            </TD>
                        </TR>
                        <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='20'></TD></TR>
                        <TR>
                            <TD align=center colspan='4'>
                            <chiptrack:restrictedLink functionality='<%=Functionality.MRB_BIN_SETUP%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:submitForm();" onmouseover="window.status='Click here to save Assembly Groups';return true" onmouseout="window.status='';return true">
                                <img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17"  onmouseover="window.status='Click here to save Assembly Groups';return true" onmouseout="window.status='';return true" title="Click here to save Assembly Groups" >
                            </chiptrack:restrictedLink>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <a href="<%=chipTracContext%>/assemblyBinSetup.do?screenType=baseProductBins"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" width="53" height="17" onmouseover="window.status='Click to Cancel Changes';return true" onmouseout="window.status='';return true" title="Click here to Cancel Changes"></a>
                        </TD>
                        </TR>
                        </logic:greaterThan>                      
            
                    </TABLE>
                </html:form>
                </TD><TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
            </TR>
            <TR>
        </TABLE>
        <!-- Footer starts here -->
        <%@ include file="/jsp/includes/footer.jsp" %>
        <!-- footer end here -->
    </BODY>
</HTML>